// 轮播图
let swiperArr = [
    {s:.8,x:-95,z:1},
    {s:1,x:137,z:2},
    {s:.8,x:438,z:1},
    {s:.8,x:1200,z:1},
    {s:.8,x:1200,z:1},
    {s:.8,x:1200,z:1}
]

function swiperFn(){
    let divObjs=document.querySelectorAll('section.swiper .swiper-slide')
    divObjs.forEach((item,i)=>{
        item.style.transform=`scale(${swiperArr[i].s}) translateX(${swiperArr[i].x}px)`
        item.style.zIndex=swiperArr[i].z
    })
}
swiperFn()
function prevFn(){
    let temp=swiperArr.shift()
    swiperArr.push(temp)
    console.log(temp);
    swiperFn()
}
function nextFn(){
    let temp=swiperArr.pop()
    swiperArr.unshift(temp)
    swiperFn()
}
document.querySelector('section.swiper .swiper-prev').onclick=function(){
    prevFn()
}
document.querySelector('section.swiper .swiper-next').onclick=function(){
    nextFn()
}
let divObjs=document.querySelectorAll('section.swiper .swiper-slide')
    divObjs.forEach((item,i)=>{
        item.onclick=function(){
            let style=item.style.transform
            if(style.indexOf('-95px')!=-1){
               prevFn()
            }
            if(style.indexOf('438px')!=-1){
               nextFn()
            } 
        } 
    })